//***************************************************
// Program FOR SEPARATION OF FFP OUT OF 3BTT  CPD and SAGM
// DDP - LUXOMATIC
// Adapted by lin
// 08.12.2010
// 09.09.2011 by paul modify
// PROGRAM STEPS
// 1.SENSOR ADJUSTMENT
// 2.PLASMA SEPARATION
// 3.CHECK SAGM FLOW
// 4.ADDING SAGM
// 5.PLASMA SEPARATION
//***************************************************

PROGRAM=21-300ml-170ml
BAG_TYPE=3B-T/T
ALL_CLAMPS=ACD

PLACE=1;        LIQ=??????;		CLAMP=A;        NET=(TOTAL-30)/1.06;	SHOULDREAD=1;		PROGCODE=41;      
PLACE=3;        LIQ=???;		CLAMP=D;	NET=(TOTAL-25)/1.03;	SHOULDREAD=1; 
PLACE=5;        LIQ=????;		CLAMP=C;	SHOULDREAD=0; 

PROG_MENUS=SB;
MB_WEIGHT=30

BEGIN_PROG_ON_START
        DO_CLAMPS=CLOSE
        DO_PRESS_A=BCK
        DO_PRESS_B=NOTHING
END_PROG_ON_START
BEGIN_PROG_ON_FINISH
        DO_CLAMPS=OPEN
        DO_PRESS_A=MIDDLE
        DO_PRESS_B=NOTHING
END_PROG_ON_FINISH
BEGIN
       
        PROGRAM_STEP=??????
        BEGIN
                SOURCE_PLACE=1
                DEST_PLACE=3
                ACTIVE_CLAMPS=AD
                SOURCE_LIQ=WHOLE_BLOOD
                DEST_LIQ=PLASMA
                TIMEOUT=60000
                TIME_TO_STABLE=1000
                WAIT_TO_CHECKS_CONDS=0
                BEGIN_ON_START
                        DO_CLAMPS=OPEN
                        DO_PRESS_A=FWD
                        DO_PRESS_B=NOTHING
                END_ON_START
                BEGIN_ON_FINISH
                        DO_CLAMPS=CLOSE
                        DO_PRESS_A=NOTHING
                        DO_PRESS_B=NOTHING
	                LEARNING_SENSOR=MUX
                END_ON_FINISH
                BEGIN_REG_COND
                        TYPE=V
                        NAME=B3
                        VALUE=70                          
                END_REG_COND
        END_STEP

        PROGRAM_STEP=???????1 
        BEGIN
                SOURCE_PLACE=1
                DEST_PLACE=3
                ACTIVE_CLAMPS=AD
                SOURCE_LIQ=WHOLE_BLOOD
                DEST_LIQ=PLASMA
		//HIGH_PRESSURE
                //FLOW_CONTROL
		//REF_FLOW=777721
                TIMEOUT=180000
                TIME_TO_STABLE=1000
                WAIT_TO_CHECKS_CONDS=0
                BEGIN_ON_START
                        DO_CLAMPS=OPEN
                        DO_PRESS_A=FWD
                        DO_PRESS_B=NOTHING
                END_ON_START
                BEGIN_ON_FINISH
                        DO_CLAMPS=CLOSE
                        DO_PRESS_A=NOTHING
                        DO_PRESS_B=NOTHING
                END_ON_FINISH
                BEGIN_REG_COND
                       	TYPE=&
                        NAME=SENSORS
                        VALUE=M1&M2
	        END_REG_COND
        END_STEP

        PROGRAM_STEP=???????2
        BEGIN
                SOURCE_PLACE=1
                DEST_PLACE=3
                ACTIVE_CLAMPS=AD
                SOURCE_LIQ=WHOLE_BLOOD
                DEST_LIQ=PLASMA
                FLOW_CONTROL
		REF_FLOW=2.0
                TIMEOUT=180000
                TIME_TO_STABLE=0
                WAIT_TO_CHECKS_CONDS=0
                BEGIN_ON_START
                        DO_CLAMPS=OPEN
                        DO_PRESS_A=FWD
                        DO_PRESS_B=NOTHING
                END_ON_START
                BEGIN_ON_FINISH
                        DO_CLAMPS=CLOSE
                        DO_PRESS_A=BCK
                        DO_PRESS_B=NOTHING
                END_ON_FINISH
                BEGIN_REG_COND
                       	TYPE=&
                        NAME=SENSORS
                        VALUE=M1&E1
	        END_REG_COND
                BEGIN_REG_COND
                        TYPE=&
                        NAME=SENSORS
                        VALUE=M1&E2
	        END_REG_COND
                BEGIN_REG_COND
                       	TYPE=W
                        NAME=B3
                        VALUE=5
	        END_REG_COND
        END_STEP

	PROGRAM_STEP=???????
	BEGIN
		SOURCE_PLACE=5
		DEST_PLACE=1
		ACTIVE_CLAMPS=AC
		SOURCE_LIQ=SAGM
		DEST_LIQ=WHOLE_BLOOD
		TIMEOUT=600000
		TIME_TO_STABLE=1000
		WAIT_TO_CHECKS_CONDS=0
		SAGMD=1200
		BEGIN_ON_START
			DO_CLAMPS=OPEN
			DO_PRESS_A=BCK
			DO_PRESS_B=NOTHING
		END_ON_START
		BEGIN_ON_FINISH
			DO_CLAMPS=OPEN
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_FINISH
		BEGIN_FAIL_COND
		END_FAIL_COND
		BEGIN_REG_COND
		END_REG_COND
	END_STEP

	PROGRAM_STEP=ADDING SAGM
	BEGIN
		SOURCE_PLACE=5
		DEST_PLACE=1
		ACTIVE_CLAMPS=AC
		SOURCE_LIQ=SAGM
		DEST_LIQ=WHOLE_BLOOD
		//HIGH_PRESSURE
		TIMEOUT=80000
		TIME_TO_STABLE=0
		WAIT_TO_CHECKS_CONDS=0
		BEGIN_ON_START
			DO_CLAMPS=OPEN
			DO_PRESS_A=BCK
			DO_PRESS_B=NOTHING
		END_ON_START
		BEGIN_ON_FINISH
			DO_CLAMPS=CLOSE
			DO_PRESS_A=MIDDLE
			DO_PRESS_B=NOTHING
		END_ON_FINISH
		//BEGIN_FAIL_COND
		//END_FAIL_COND
		BEGIN_REG_COND
			TYPE=C
			NAME=T
			VALUE=5000
		END_REG_COND
	END_STEP

	PROGRAM_STEP=????
	BEGIN
		SOURCE_PLACE=5
		DEST_PLACE=3
		ACTIVE_CLAMPS=AC
		SOURCE_LIQ=SAGM
		DEST_LIQ=WHOLE_BLOOD
		//HIGH_PRESSURE
		TIMEOUT=80000
		TIME_TO_STABLE=0
                WAIT_TO_CHECKS_CONDS=0
		BEGIN_ON_START
			DO_CLAMPS=NOTHING
			DO_PRESS_A=NOTHNIG
			DO_PRESS_B=NOTHING
		END_ON_START
		BEGIN_ON_FINISH
			DO_CLAMPS=CLOSE
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_FINISH
		BEGIN_REG_COND
                        TYPE=C
                        NAME=T
                        VALUE=2000
		END_REG_COND
	END_STEP

	PROGRAM_STEP=???????
	BEGIN
		SOURCE_PLACE=3
		DEST_PLACE=5
		ACTIVE_CLAMPS=CD
		SOURCE_LIQ=PLASMA
		DEST_LIQ=SAGM
		//HIGH_PRESSURE
		TIMEOUT=500000
		TIME_TO_STABLE=0
		BEGIN_ON_START
			DO_CLAMPS=OPEN
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_START
		BEGIN_ON_FINISH
			DO_CLAMPS=CLOSE
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_FINISH
		BEGIN_REG_COND
                        TYPE=V
                        NAME=B3
                        VALUE=-191
		END_REG_COND
	END_STEP

	PROGRAM_STEP=SEAL CLAMP A
	BEGIN
		ACTIVE_CLAMPS=ACD
		TIMEOUT=8000
		BEGIN_ON_START
			DO_CLAMPS=CLOSE
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_START
		BEGIN_ON_FINISH
			DO_CLAMPS=NOTHING
			DO_SEAL=A
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_FINISH
		BEGIN_FAIL_COND
		END_FAIL_COND
		BEGIN_REG_COND
                        TYPE=C
                        NAME=T
                        VALUE=0
		END_REG_COND
	  END_STEP


	PROGRAM_STEP=21-300ml-170ml
	BEGIN
		SHOW_MESSAGE=??(???)???????????????鱣???????????????????????
		ACTIVE_CLAMPS=A
		TIMEOUT=5000
		BEGIN_ON_START
			DO_CLAMPS=OPEN
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_START
		BEGIN_ON_FINISH
			DO_CLAMPS=NOTHING
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_FINISH
		BEGIN_REG_COND
                        TYPE=C
                        NAME=T
                        VALUE=0
		END_REG_COND
	  END_STEP

	PROGRAM_STEP=21-300ml-170ml
	BEGIN
		SHOW_MESSAGE=?????????????????????
		ACTIVE_CLAMPS=A
		TIMEOUT=5000
		BEGIN_ON_START
			DO_CLAMPS=OPEN
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_START
		BEGIN_ON_FINISH
			DO_CLAMPS=NOTHING
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_FINISH
		BEGIN_REG_COND
                        TYPE=C
                        NAME=T
                        VALUE=0
		END_REG_COND
	  END_STEP

	PROGRAM_STEP=OPEN ACD
	BEGIN
		ACTIVE_CLAMPS=ACD
		TIMEOUT=8000
		BEGIN_ON_START
			DO_CLAMPS=OPEN
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_START
		BEGIN_ON_FINISH
			DO_CLAMPS=NOTHING
			DO_PRESS_A=NOTHING
			DO_PRESS_B=NOTHING
		END_ON_FINISH
		BEGIN_FAIL_COND
		END_FAIL_COND
		BEGIN_REG_COND
			TYPE=C
			NAME=T
			VALUE=0
		END_REG_COND
	END_STEP

END_PROGRAM